<template>
<view class="user-promote-order" style="margin-top: -0rpx;">
	<!-- 没有martop-100,内页之前top="80rpx"就正常 -->
   <tabs :current="active" @change="onChange" bar-width="60" :is-scroll="false">
       <tab v-for="(item, index) in order" :key="index" :name="item.name">
           <spread-order :time="time" :type="item.type" :i="index" :index="active"></spread-order>
       </tab>
   </tabs>
</view>
</template>

<script>

import { distributionOrder } from "@/utils/type";

export default {
  data() {
    return {
      order: [{
        name: "全部",
        type: distributionOrder.ALL,
      }, {
        name: "待结算",
        type: distributionOrder.WAIT_RETURN,
      }, {
        name: "已结算",
        type: distributionOrder.HANDLED,
      }, {
        name: "退款/售后",
        type: distributionOrder.INVALED,
      }],
      active: '',
      time: '',
    };
  },

	onLoad: function (options) {
		console.log('options',options)
		this.time = options.time
		if(options.type == 0){
			this.active = distributionOrder.ALL
		}
		if(options.type == 1){
			this.active = distributionOrder.WAIT_RETURN
		}
		if(options.type == 2){
			this.active = distributionOrder.HANDLED
		}
		if(options.type == 3){
			this.active = distributionOrder.INVALED
		}
		if(options.type == 4){
			this.active = distributionOrder.INVALED
		}
	},

	methods: {
		onChange(index) {
			this.active = index
		},
	}
};
</script>
<style>
</style>